import service from "@/utils/request";

//发送验证码
export function sendCodeService(params = {}) {
  return service({
    url: "/user/sendCode",
    method: "post",
    data: params,
  });
}

//登录或注册
export function codeLoginService(params = {}) {
  return service({
    url: "/user/login",
    method: "post",
    data: params,
  });
}
//注销登录
export function logoutService() {
  return service({
    url: "/user/logout",
    method: "delete",
  });
}

//获取用户详情
export function getUserInfoService() {
  return service({
    url: "/user/info",
    method: "get",
  });
}

//获取用户详情
export function getUserDetailService(userId) {
  return service({
    url: "/user/detail",
    method: "get",
    params: { userId },
  });
}

//编辑用户信息
export function editUserService(params = {}) {
  return service({
    url: "/user/edit",
    method: "put",
    data: params,
  });
}

//更新头像
export function updateHeadImageService(params = {}) {
  return service({
    url: "/user/head-image/update",
    method: "put",
    data: params,
  });
}


//向后端提交代码
export function userSubmitService(params = {}) {
  return service({
    url: "/user/question/submit",
    method: "post",
    data: params,
  });
}